var loadImg="";
Vue.directive("preload",function(el,binding){
    if(binding.modifiers.bg){
        el.style.backgroundImage=`url(${loadImg})`;
        el.style.backgroundRepeat="no-repeat";
        el.style.backgroundPosition="center";
    }else{
        el.src=loadImg;
        el.style.objectFit="none";
        el.style.objectPosition="center";
    }
    let img=new Image();
    img.src=binding.value;
    img.onload=function(){
        if(binding.modifiers.bg){
            el.style.backgroundImage=`url(${binding.value})`;
        }else{
            el.src=binding.value;
            el.style.objectFit=binding.arg;
        }
    }
})